import { defineAsyncComponent } from "vue";

const jsxComponents = import.meta.glob("./BaseComponent/*.jsx");
const vueComponents = import.meta.glob("./BaseComponent/*.vue");
const components = { ...jsxComponents, ...vueComponents };

export default function install(app) {
  for (const [k, v] of Object.entries(components)) {
    const name = k.slice(k.lastIndexOf("/") + 1, k.lastIndexOf("."));
    app.component(name, defineAsyncComponent(v));
  }
}
